$(document).ready(function(){
	loadsTop1();
	loadsTop2();
	loadsTop3();
	loadsTop4();
});


function loadsTop1(){

	var judete = Array();
	var numere = Array();
	$.getJSON('function/sidebar.php?box=box1', function(data) {
		$.each(data, function(key, val) {
			judete.push(key);
			numere.push(val); 
		});
		drawChart(judete,numere,'Top Judete','chart_div1');
	});
}
function loadsTop2(){
	var judete = Array();
	var numere = Array();
		$.getJSON('function/sidebar.php?box=box2', function(data) {
		$.each(data, function(key, val) { 
			judete.push(val[1]);
			numere.push(val[0]);
		});
		drawChart(judete,numere,'Top Angajatori','chart_div2');
	});
	}
function loadsTop3(){
	var judete = Array();
	var numere = Array();
		$.getJSON('function/sidebar.php?box=box3', function(data) {
		$.each(data, function(key, val) { 
			judete.push(val[1]);
			numere.push(val[0]);
		});
		drawChart(judete,numere,'Top Posturi','chart_div3');
	});	
}
function loadsTop4(){
	var judete = Array();
	var numere = Array();
		$.getJSON('function/sidebar.php?box=box4', function(data) {
			console.log(data);
		$.each(data, function(key, val) { 
			judete.push(key);
			numere.push(val[0]);
		});
		drawChart(judete,numere,'Top Institutii','chart_div4');
	});	
}

